package com.lhd.qd.common.exception;

import com.lhd.qd.common.consts.ErrorCodeEnum;

/**
 * 业务异常
 */
public class BusinessException extends RuntimeException {

    /**
     * 错误编码
     */
    private Integer code;


    public BusinessException(String msg) {
        super(msg);
    }

    public BusinessException(String msg, Throwable t) {
        super(msg, t);
    }

    public BusinessException(ErrorCodeEnum errorCodeEnum) {
        super(errorCodeEnum.getMsg());
        this.code = errorCodeEnum.getCode();
    }

    public BusinessException(ErrorCodeEnum errorApiStatusEnum, Throwable t) {
        super(errorApiStatusEnum.getMsg(), t);
        this.code = errorApiStatusEnum.getCode();
    }

    public BusinessException(Integer code, String msg, Throwable t) {
        super(msg, t);
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
